﻿using System;
using System.ServiceProcess;
using System.Threading;
using ShellCommandsClientService.ShellCommandServiceReference;

namespace ShellCommandsClientService
{
    public partial class ShellCommandsExecutionManager : ServiceBase
    {
        private MyCallBack callBack;
        public ShellCommandsExecutionManager()
        {
            InitializeComponent();
            callBack=new MyCallBack();
        }

        protected override void OnStart(string[] args)
        {
            callBack.callService();
            ShellCommandClient shellClient = new ShellCommandClient();
            String machineName = Environment.MachineName;
            shellClient.Execute(new ShellCommandInfo() { MachineName = machineName, Text = "dir", IpAddress = string.Empty });
            Thread.Sleep(5000);
        }

        protected override void OnStop()
        {
            callBack.Dispose();
        }
    }
}
